{% extends 'AdminPanelDashboardBundle::layout.html.twig' %}


{% block stylesheets %}
  {{ parent() }}
{% endblock %}
{% block javascripts %}      
  {{ parent() }}
{% endblock %}


{% block content %}

<div id="content">
  <ul class="breadcrumb">
    <li><a href="/admin" class="glyphicons home"><i></i> Нүүр</a></li>
    <li class="divider"></li>
    <li>Хичээл</li>
  </ul>
  <div class="separator"></div>

  <div class="heading-buttons">
    <h3 class="glyphicons sort"><i></i> Хичээлийн жагсаалт</h3>    
  </div>
  <div class="separator"></div>

  <div class="innerLR">
    <div>
      <form action="{{path('lessonList')}}" method="post">
        <table style="width: 100%">
          <tr>
            <td><h5>Эхлэх огоо : </h5></td>
            <td><input type="text" class="hasDatepicker" name="beginDate" id="beginDate" value="{{beginDate}}"></td>
            <td><h5>Дуусах огоо : </h5></td>
            <td><input type="text" class="hasDatepicker" name="endDate" id="endDate" value="{{endDate}}"></td>                    
            <td><h5>Төлөв : </h5></td>
            <td>
              <select name="type" class="selectpicker span6" data-style="btn-success">
                {% render url('lessonStatusListForChoice', { 'selected': type }) %}                
              </select>
            </td>            
          </tr>
          <tr>
            <td><h5>Багш : </h5></td>
            <td>              
              <select name="tutor">
                <option value="all">Бүгд</option>
                {% if tutorList is not null%}
                  {% for key, value in tutorList %}
                <option value="{{key}}" {% if tutor == key %} selected="selected" {% endif %}>{{value}}</option>
                  {% endfor %}
                {% endif %}
              </select>
            </td>
            <td><h5>Сурагч : </h5></td>
            <td>                       
              <select name="student">
                <option value="all">Бүгд</option>
                {% if studentList is not null%}
                  {% for key, value in studentList %}
                <option value="{{key}}" {% if student == key %} selected="selected" {% endif %}>{{value}}</option>
                  {% endfor %}
                {% endif %}
              </select>
            </td>
            <td style="text-align: right">              
            </td>
            <td>
              <input type="button" class="btn btn-block btn-info" onclick="javascript: document.location.href = '/admin/lesson/list'" style="width: 100px;float: left;margin: 5px 10px 0px 0px;" value="Цэвэрлэх"/>
              <button type="submit" class="btn btn-block btn-success btn-icon glyphicons ok" style="width: 100px;float: left"><i></i>Хайх</button>
            </td>
          </tr>
        </table>
      </form>
    </div>
    <div>
      <table class="table table-bordered table-condensed table-striped table-vertical-center checkboxs js-table-sortable">
        <thead>
          <tr>
            <th style="width: 30px">№</th>            
            <th>Хичээлийн нэр</th>
            <th style="width: 120px">Багш</th>
            <th style="width: 120px">Сурагч</th>
            <th style="width: 80px">Төлөв</th>
            <th style="width: 120px">Үүсгэсэн огноо</th>
            <th style="width: 120px">Гэрээ үүссэн эсэх</th>
            <th style="width: 125px">Гэрээ үүссэн огноо</th>                        
            <th style="width: 70px"></th>
          </tr>
        </thead>
        <tbody>
          {% set counter = 1%}
          {% for lesson in lessonList %}
            <tr>
              <td>{{counter}}</td>              
              <td><b>{{lesson.SUBJECT_NAME}}</b>&nbsp;&nbsp;&nbsp;({{lesson.SUBJECT_CATEGORY_NAME}})</td>
              <td>{{lesson.TUTOR_NAME}}</td>
              <td>{{lesson.STUDENT_NAME}}</td>
              <td>{% render url('lessonStatusNameChange', { 'status': lesson.STATUS}) %}</td>
              <td>{{lesson.CREATED_AT}}</td>
              <td>{% if lesson.CONTRACT_STATUS is not null %}{% render url('statusNameChange', { 'status': lesson.CONTRACT_STATUS}) %}{% endif %}</td>
              <td>{{lesson.CONTRACT_CREATED_AT}}</td>              
              <td><a href="{{path('showLesson', {'id' : lesson.ID})}}" style="text-decoration: none;"><button class="btn btn-block btn-success" style="font-size: 9px;width: 70px;">Үзэх</button></a></td>
            </tr>
          {% set counter = counter + 1 %}
          {% endfor %}
          </tbody>
        </table>
        <div>

        </div>
      </div>
    </div>
    <br/>		
    <!-- End Content -->
  </div>

{% endblock %}
